var WxParse = require('../../wxParse/wxParse.js');
//获取应用实例
var app = getApp()
Page({
  data: {
  },
  onLoad:function(){
    var that = this;
    that.resuestShoplist();
  },
  onShow: function () {
    var that = this;
    app.setNavtitle('收录分类');
  },
  resuestShoplist:function(){
    var that = this;
    wx.showLoading({
      title: '加载中',
    })
    wx.request({
      url: app.globalData.requestUrl,
      data: {
        map: 'applet_mobile_category_list'
      },
      success: function (res) {
        if (res.data.ec == 200) {
          console.log(res.data.data);
          that.setData({
            shopList: res.data.data
          })
        } else {
          console.log(res.data)
          that.setData({
            shopList: []
          })
          app.errorTip(that, res.data.em, 2000);
        }
      },
      complete: function () {
        wx.hideLoading();
      }
    });
  },
  toShopinfolist:function(e){
    var id = e.currentTarget.dataset.id;
    var title = e.currentTarget.dataset.title;
    wx.navigateTo({
      url: '/subpages/shopInfoList/shopInfoList?id=' +id+ '&title=' + title,
    })
  }
})
